package com.example.demo.event;

import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

@Component
class NoticeListener implements ApplicationListener<NoticeEvent> {
    @Override
    public void onApplicationEvent(NoticeEvent noticeEvent) {
        System.out.println("进程"+noticeEvent.getMessage()+"执行后，睡眠2秒");
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("进程"+noticeEvent.getMessage()+"执行结束");

    }
}
